In related art, a ranging method called time of flight (ToF) is often used in an electronic device having a ranging function. The ToF is a method in which a light emitting unit irradiates an object with irradiation light having a sine wave or a rectangular wave, and a light receiving unit receives reflection light from the object, and then a ranging calculation unit measures a distance on the basis of a phase difference between the irradiation light and the reflection light. For example, a device that receives reflection light by using an image sensor, and performs ranging by the ToF method is disclosed (refer to Non-Patent Document 1, for example).
This image sensor detects a received light quantity from 0 degrees to 180 degrees as Q1, and detects a received light quantity from 180 degrees to 360 degrees as Q2 while setting, as 0 degrees, a specific phase (such as a timing of rising) of a light emission control signal that controls the light emitting unit. Additionally, the image sensor detects a received light quantity from 90 degrees to 270 degrees as Q3, and detects a received light quantity from 270 degrees to 90 degrees as Q4. The distance is measured by a following Expression by using the received light quantities Q1 to Q4.d=(c/4Πf)×tan−1{(Q3−Q4)/(Q1−Q2)}   Expression 1
In the above Expression, d represents a distance, and the unit is, for example, meters (m). c represents a light speed, and the unit is, for example, meters per second (m/s). tan−1 represents an inverse function of a tangent function. A value of (Q3−Q4)/(Q1−Q2) represents a phase difference between the irradiation light and the reflection light. Π represents a circumference ratio. Additionally, f represents a frequency of the irradiation light, and the unit is, for example, megahertz (MHz).